﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace demo.Tool
{
    public interface Iado
    {
        /// <summary>
        /// 返回受影响条数
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="type"></param>
        /// <param name="pars"></param>
        /// <returns></returns>
        int ExecuteNonquery(string sql, CommandType type, params SqlParameter[] pars);
        /// <summary>
        /// 返回object对象
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="type"></param>
        /// <param name="pars"></param>
        /// <returns></returns>
        object ExecuteScalar(string sql, CommandType type, params SqlParameter[] pars);
        /// <summary>
        /// 查询数据返回table
        /// </summary>
        /// <param name="dbo"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        DataTable Ex_Procedure(string dbo, Dictionary<string, string> data);
        /// <summary>
        /// 调用存储过程返回list集合
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="dbo"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        List<T> Ex_ProcedureList<T>(string dbo, Dictionary<string, object> data) where T : class, new();
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="sql"></param>
        /// <param name="obj"></param>
        /// <returns></returns>
        List<T> GetDataList<T>(string sql, object obj) where T : class, new();
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="sql"></param>
        /// <param name="obj"></param>
        /// <returns></returns>
        T GetDataT<T>(string sql, object obj) where T : class, new();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="obj"></param>
        /// <returns></returns>
        int ExecuteNonquery(string sql, object obj);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="obj"></param>
        /// <returns></returns>
        DataTable GetDataTable(string sql, object obj);
        ///// <summary>
        ///// 返回json字符(多数据)
        ///// </summary>
        ///// <param name="sql"></param>
        ///// <param name="obj"></param>
        ///// <returns></returns>
        //string GetDataJsonList(string sql, object obj);
        ///// <summary>
        ///// 返回json字符(单挑数据)
        ///// </summary>
        ///// <param name="sql"></param>
        ///// <param name="obj"></param>
        ///// <returns></returns>
        //string GetDataJson(string sql, object obj);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="table"></param>
        /// <param name="ServerTableName"></param>
        /// <returns></returns>
        bool AddDataTableToDB(DataTable table, string ServerTableName);
    }
}
